using UnityEngine;

public class MusicButton:MonoBehaviour
{
    public bool isBgm = false;
    public GameObject lockObj;

    private void Start()
    {
        if(isBgm)
        {
            if(AudManager.instance.bgm.volume==0)
            {
                lockObj.SetActive(true);
            }
            else
            {
                lockObj.SetActive(false);
            }
        }
        else
        {
            if (AudManager.instance.aud.volume==0)
            {
                lockObj.SetActive(true);
            }
            else
            {
                lockObj.SetActive(false);
            }
        }
    }
    public void Click()
    {
        if(isBgm)
        {
            if(lockObj.activeSelf==true)
            {
                lockObj.SetActive(false);
                AudManager.instance.OpenBgm();
                AudManager.instance.PlayUIAud(AudManager.instance.uiDic["点击"], 1f);
            }
            else
            {
                lockObj.SetActive(true);
                AudManager.instance.CloseBgm();
            }
        }
        else
        {
            if (lockObj.activeSelf==true)
            {
                lockObj.SetActive(false);
                AudManager.instance.OpenAud();
                AudManager.instance.PlayUIAud(AudManager.instance.uiDic["点击"], 1f);
            }
            else
            {
                lockObj.SetActive(true);
                AudManager.instance.CloseAud();

            }
        }
    }
}